<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('曝光台')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li>
                                <label>曝光标题：</label>
                                <input type="text" name="arrangeName"/>
                            </li>
                            <!--<li>
                                <label>填报状态：</label>
                                <select name="status">
                                    <option value="">所有</option>
                                    <option value="0">待填报</option>
                                    <option value="1">已填报</option>
                                    &lt;!&ndash;<option value="8">逾期未上报</option>&ndash;&gt;
                                </select>
                            </li>
                            <li class="select-time">
                                <label>截止日期：</label>
                                <input type="text" class="time-input" id="startTime" placeholder="开始日期" name="params[startDate]"/>
                                <span>-</span>
                                <input type="text" class="time-input" id="endTime" placeholder="结束日期" name="params[endDate]"/>
                            </li>-->
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var removeFlag = [[${@permission.hasPermi('work:progress:remove')}]];
        var detailFlag = [[${@permission.hasPermi('work:progress:detail')}]];
        var receiveFlag = [[${@permission.hasPermi('work:progress:receive')}]];
        var fullFlag = [[${@permission.hasPermi('work:progress:fill')}]];
        var statusDatas = [[${@dict.getType('status1')}]];
        var editFlag = [[${@permission.hasPermi('document:file:edit') }]];
        
        var prefix = ctx + "exposure/progress";

        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                modalName: "曝光台列表",
                sortName: "updateTime",
		        sortOrder: "desc",
                columns: [{
                    checkbox: true
                },
                {
                    field: 'progressId',
                    title: '曝光进度ID',
                    visible: false
                },
                {
                    field: 'arrangeName',
                    title: '曝光标题'
                },
                {
                    field: 'status',
                    title: '查看状态',
                    formatter: function(value, row, index) {
                       return $.table.selectDictLabel(statusDatas, value);
                    }
                },
                    {
                        field: 'fileId',
                        title: '附件编号',
                        visible: false
                    },
                    {
                        field: 'fileName',
                        title: '附   件'
                    },
                {
                    field: 'userName',
                    title: '发起人',
                    visible: false
                },
                {
                    field: 'deptName',
                    title: '发起部门'
                },
                    {
                        field: 'remark',
                        title: '备注'
                    },
                /*{
                    field: 'endDate',
                    title: '截止日期'
                },
                {
                    field: 'id',
                    title: '记录序号'
                },*/
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                            //actions.push('<a class="btn btn-warning btn-xs ' + detailFlag + '" href="javascript:void(0)" onclick="view_detail(\'' + row.progressId + '\')"><i class="fa fa-search"></i>详情</a> ');
                            actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="previewFile(\'' + row.fileId + '\',\'' + row.fileName + '\')"><i class="fa fa-edit"></i>预览</a> ');
                        return actions.join('');
                    }
                }]
            };
            $.table.init(options);
        });

        function receive(progressId){
            var url = prefix+"/receive"
            $.ajax({
				cache : true,
				type : "POST",
				url : url,
				data : {
					"progressId": progressId,
				},
				async : false,
				error : function(request) {
					$.modal.alertError("系统错误");
				},
				success : function(data) {
					$.operate.successCallback(data);
				}
			});
        }

        function fill_in(progressId){
            var url = prefix + "/fill_in/" + progressId
            $.modal.openTab('任务填报', url);
        }

        function view_detail(progressId){
            var url = ctx +"exposure/exposure/detail/" + progressId
            var options = {
                    title: "详情",
                    url: url,
                    full: true,
                    btn: ['关闭'],
                    yes: function (index, layero) {
                        layer.close(index);
                    }
                };
            $.modal.openOptions(options);
        }
    </script>
</body>
</html>